package com.app.model 
{
	import com.app.model.data.HallListItemData;
	
	import org.puremvc.as3.patterns.proxy.Proxy;
	import org.puremvc.as3.interfaces.IProxy;
	
	/**
	 * ...
	 * @author kevin
	 */
	public class RoomListProxy extends Proxy implements IProxy
	{
		public static const NAME:String = 'RoomListProxy';
		
		private var _roomList:Array = [];
		
		public function RoomListProxy() 
		{
			super(NAME);
		}
		
		public function set roomList(roomList:Array):void
		{
			_roomList = roomList;
		}
		
		public function get roomList():Array
		{
			return _roomList;
		}
		
		public function addRoom(room:HallListItemData):void
		{
			_roomList.push(room);
		}
		
		public function get(roomid:int):HallListItemData
		{
			var len:int = _roomList.length;
			for (var i:int = 0; i < len; i++)
			{
				if (HallListItemData(_roomList[i]).roomid == roomid)
				{
					return HallListItemData(_roomList[i]);
				}
			}
			
			return null;
		}	
	}

}